package com.aa.activity;

import com.aa.Common;
import com.aa.R;
import com.aa.YaloeActivity;
import com.aa.YaloeApplication;
import com.aa.YaloeLauncherActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MyAccountActivity extends Activity  implements OnClickListener{
	private Button mbtnTitleBack;
	private TextView mtvTitleCenter;
	private TextView mtvPhoneNumber;
	private TextView mtvEmail;
	private LinearLayout mLayFindPws;
	private LinearLayout mLayCancelAccount;
	@Override
	protected void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_accont);
		initView();
	}

	private void initView(){
		mbtnTitleBack = (Button)findViewById(R.id.btn_title_back);
		mbtnTitleBack.setOnClickListener(this);
		mtvTitleCenter = (TextView)findViewById(R.id.tv_title_center);
		mtvTitleCenter.setText(R.string.my_account);
		
		mtvPhoneNumber = (TextView)findViewById(R.id.tv_bound_phone_number);
		mtvPhoneNumber.setText(Common.iMyPhoneNumber);
		mtvEmail = (TextView)findViewById(R.id.tv_bonud_mail);
		
		mLayFindPws = (LinearLayout)findViewById(R.id.lay_find_password);
		mLayFindPws.setOnClickListener(this);
		
		mLayCancelAccount = (LinearLayout)findViewById(R.id.lay_cancel_account);
		mLayCancelAccount.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_title_back:
			finish();
			break;

		case R.id.lay_find_password:
			
			Intent _Intent = new Intent(MyAccountActivity.this, ChangePasswordActivity.class);
			startActivity(_Intent);
			
			break;
		case R.id.lay_cancel_account:
			Common.iMyPhoneNumber = "";
			Common.iUID = "";
			Common.iPassword = "";
			Common.iAlias = "";
			Common.iArea = "";
			Common.iAutograph = "";
			Common.iBirthday = "";
			Common.iBitmapNames.clear();
			Common.iRemaingTime = "";			
			Common.iSexname = "";
			Common.iJob = "";
			Common.iName = "";
			Common.iDream = "";
			Common.saveUserInfo(MyAccountActivity.this);
			Common.iLogin = 0;
			
			 Intent _Intent2 = new Intent();
		     _Intent2.setClass(MyAccountActivity.this, LoginActivity.class);
		     _Intent2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		     if (YaloeActivity.isInstanciated()) {
				YaloeActivity.instance().finish();
			}
		     startActivity(_Intent2);
		     finish();
			break;
		}
		
		
	}
	
	
}
